'''
Created on Feb 23, 2012

@author: Andrzej
'''

import PyDaq.Hardware.Avr as Avr
import time

Mo = Avr.AvrShell(port=7)

Mo.debug = 1
for p in range(255):
    cmd = "pwm 1 0 %d" % p
    Mo.send(cmd)
    time.sleep(0.0)

cmd = "pwm 1 0 %d" % 0
Mo.send(cmd)
for p in range(255):
    cmd = "pwm 2 0 %d" % p
    Mo.send(cmd)
    time.sleep(0.0)

cmd = "pwm 1 0 %d" % 100
Mo.send(cmd)
cmd = "pwm 2 1 %d" % 100
Mo.send(cmd)
time.sleep(2)

cmd = "pwm 1 1 %d" % 100
Mo.send(cmd)
cmd = "pwm 2 0 %d" % 100
Mo.send(cmd)
time.sleep(2)

cmd = "pwm 1 1 %d" % 100
Mo.send(cmd)
cmd = "pwm 2 1 %d" % 100
Mo.send(cmd)
time.sleep(1)

cmd = "pwm 1 0 %d" % 100
Mo.send(cmd)
cmd = "pwm 2 0 %d" % 100
Mo.send(cmd)
time.sleep(1)


Mo.send("p")
Mo.close()